package com.guizi.halftimesroom.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.guizi.halftimesroom.R;
import com.guizi.halftimesroom.bean.ActiveDrawerBean;
import com.guizi.halftimesroom.bean.Rank;

import java.util.List;

/**
 * Created by Alan on 2016/7/20.
 */
public class ActiveIllestView extends LinearLayout {
    private Context mContext;
    private HorizontalScrollView hsv_illust;
    private TextView tv_activetitle,tv_active_illust;

    public ActiveIllestView(Context context) {
        this(context,null);
    }

    public ActiveIllestView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public ActiveIllestView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        this.mContext=context;
        View view = LayoutInflater.from(mContext).inflate(R.layout.view_activedrawer, this);
        hsv_illust = (HorizontalScrollView) view.findViewById(R.id.hsv_illust);
        tv_activetitle = (TextView) view.findViewById(R.id.tv_activetitle);
        tv_active_illust = (TextView) view.findViewById(R.id.tv_activetitle);
    }

    public void setData(List<ActiveDrawerBean.DataBean> list ,String title,String top){
        tv_activetitle.setText(title);
        tv_active_illust.setText(top);
        for (int i = 0; i <list.size() ; i++) {
            PersonalCardView cardView= new PersonalCardView(mContext);
            cardView.setData(list.get(i));
            hsv_illust.addView(cardView);
        }
    }
}
